_author__ = "Terry"
__version__ = "1.0"

"""
Change History
Version 1.0 -Terry
聊天
test5环境 node_id = 3150000
test5环境 &account=ceshi03&password=5d6c8bdad4898058e13f65002a31ddef
test0环境 node_id = 3149984
test0环境 &account=ceshi03&password=5d6c8bdad4898058e13f65002a31ddef
环境中手动新增客服账号ceshi03，密码是111111
银河yhuat环境 node_id = 4198432
银河yhuat环境 &account=ceshi03&password=5d6c8bdad4898058e13f65002a31ddef


"""
from selenium import webdriver
import time

third_party_id = 1000101
node_id = '&node_id=4198432'
local_path = "file:///D:/working/socketIoTest/client.html?third_party_id="
server_url = "http:/admin.yhuat8.com"

#客户端发送请求
for i in range(10):
    clien_url = local_path + str(third_party_id) + node_id
    driver = webdriver.Chrome(executable_path=r"C:\Program Files (x86)\Google\Chrome\Application\chromedriver")
    time.sleep(1)
    driver.get(clien_url)
    time.sleep(2)
    driver.close()
    time.sleep(1)
    print('客户端请求%d次' %i)
    third_party_id = third_party_id + 1
#服务的进行接待
# driver = webdriver.Chrome(executable_path=r"C:\Program Files (x86)\Google\Chrome\Application\chromedriver")
# driver.get(server_url)
# driver.find_element_by_xpath("//div[@id='app']/div/div/div/div[2]/div/form/div[1]/div/div/input").send_keys('ceshi19')
# driver.find_element_by_xpath("//div[@id='app']/div/div/div/div[2]/div/form/div[2]/div/div/input").send_keys('111111')
# driver.find_element_by_xpath("//div[@id='app']/div/div/div/div[2]/div/form/div[3]/div/div/input").send_keys('1240')
# time.sleep(2)
# driver.find_element_by_xpath("//div[@id='app']/div/div/div/div[2]/div/form/div[4]/div/button").click()
# time.sleep(5)
# driver.find_element_by_xpath("//div[@id='LeftMenu']/ul/li[13]/span").click()
# driver.find_element_by_xpath("//div[@id='LeftMenu']/ul/li[13]/ul/li[1]/span").click()
# #接待
# time.sleep(10)
# for i in range(15):
#     #待接待
#     time.sleep(2)
#     driver.find_element_by_xpath(".//*[@id='ServiceWorkbench']/div/div[2]/div[1]/ul[2]/li/div/div/div[2]/button").click()
#     time.sleep(3)
#     driver.find_element_by_xpath("//div[2]/div/div/div/div/div[3]/button[2]").click()
#     time.sleep(3)
#     #接待中
#     driver.find_element_by_xpath("//div[@id='ServiceWorkbench']/div/div[2]/div[1]/ul[2]/li/div/div/span/sup").click()
#     time.sleep(3)
#     driver.find_element_by_id("messageText").send_keys("message")
#     time.sleep(3)
#
#     driver.find_element_by_xpath("//div[@id='ServiceWorkbench']/div/div[2]/div[2]/div[3]/div[4]").click()
#     time.sleep(3)
#     #结束会话
#     driver.find_element_by_xpath("//div[@id='ServiceWorkbench']/div/div[2]/div[2]/div[1]/div/button").click()
#     time.sleep(3)
#     driver.find_element_by_xpath("//div[2]/div/div/div/div/div[3]/button[2]").click()
#     time.sleep(3)
#     #回到待接待
#     driver.find_element_by_xpath("//*[@id='ServiceWorkbench']/div/div[2]/div[1]/ul[1]/li[1]").click()
#     time.sleep(3)
#     driver.refresh()
# driver.close()


while clien_url < 10204167:
    driver = webdriver.Chrome(executable_path=r"C:\Program Files (x86)\Google\Chrome\Application\chromedriver")

    time.sleep(1)
    url = local_path + str(third_party_id) + node_id
    driver.get(url)
    time.sleep(2)
    driver.close()
    time.sleep(2)
    driver1 = webdriver.Chrome(executable_path=r"C:\Program Files (x86)\Google\Chrome\Application\chromedriver")
    driver1.get("file:///D:/working/socketIoTest/service.html?node_id=4198432&account=ceshi05&password=ac109422cfaed52bfa6f544dfa506737")
    time.sleep(17)
    driver1.close()
    #url1 = url1 + 1